﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UtilLib.Process
{
	class Process
	{
		//TODO 任务计划
		//命令行调用的封装
		//单例启动
		//获取程序所在的目录   http://www.cnblogs.com/TianFang/archive/2013/07/05.html

		////杀死进程及子进程  http://www.cnblogs.com/TianFang/archive/2010/05/19/1739614.html
		//static void KillProcessAndChildren(int pid)
		//{
		//	ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * From Win32_Process Where ParentProcessID=" + pid);
		//	ManagementObjectCollection moc = searcher.Get();
		//	foreach (ManagementObject mo in moc)
		//	{
		//		KillProcessAndChildren(Convert.ToInt32(mo["ProcessID"]));
		//	}
		//	try
		//	{
		//		Process proc = Process.GetProcessById(pid);
		//		Console.WriteLine(pid);
		//		proc.Kill();
		//	}
		//	catch (ArgumentException)
		//	{
		//		/* process already exited */
		//	}
		//}
	}
}
